<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel common\models\AdminUserSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '管理员';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="admin-user-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a('新增管理员', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
//             ['class' => 'yii\grid\SerialColumn'],

            'id',
            'username',
            'nickname',
//             'password',
            'email:email',
            // 'profile:ntext',
            // 'auth_key',
            // 'password_hash',
            // 'password_reset_token',

            ['class' => 'yii\grid\ActionColumn',
            'template'=>'{view} {update} {resetpw} {privilege}',
            'buttons'=> [
                'resetpw'=>function ($url, $model, $key) {
                    $title = Yii::t('yii', '重设密码');
                    $options=[
                            'title' => $title,
                            'aria-label' => $title,
                            'data-pjax' => '0',
                    ];
                    return Html::a('<span class="glyphicon glyphicon-user"></span>', $url, $options);
                },
                'privilege'=>function ($url, $model, $key) {
                    $title = Yii::t('yii', '权限设置');
                    $options=[
                            'title' => $title,
                            'aria-label' => $title,
                            'data-pjax' => '0',
                    ];
                    return Html::a('<span class="glyphicon glyphicon-ok"></span>', $url, $options);
                }
            ],
        ],
    ],
    ]); ?>
</div>
